﻿using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace OutpatientApi.DTO
{
    /// <summary>
    /// 查找病人信息
    /// </summary>
    public class SearchregistrationDto
    {
        /// <summary>
        /// 住院登记唯一标识,主键,自增
        /// </summary>
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int AdmissionId { get; set; }

        /// <summary>
        /// 患者卡号，标识患者
        /// </summary>
        [Required]
        [StringLength(20)]
        public string Patient { get; set; } = string.Empty;


        /// <summary>
        /// 用户姓名 - 必填，最大长度50位
        /// </summary>
        [Required]
        [StringLength(50)]
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 关联科室表的外键,标识患者所属科室
        /// </summary>
        public int DepartmentId { get; set; }


        /// <summary>
        /// 科室类型
        /// </summary>
        public string DepartmentName { get; set; }

        /// <summary>
        /// 关联病房表的外键,标识患者入住的病房
        /// </summary>
        public int RoomId { get; set; }

        /// <summary>
        /// 病房编号,如301、302(支持前缀+数字)
        /// </summary>
        [Required]
        [StringLength(20)]
        public string RoomNumber { get; set; } = string.Empty;

        /// <summary>
        /// 所在楼层,如3、4
        /// </summary>
        public int Floor { get; set; }

        /// <summary>
        /// 关联病床号表的外键,标识患者入住的具体病床
        /// </summary>
        public int HospitalId { get; set; }

        /// <summary>
        /// 病床编号
        /// </summary>
        [Required]
        [StringLength(20)]
        public string HospitalName { get; set; } = string.Empty;

        /// <summary>
        /// 患者预交的费用金额(单位:元)
        /// </summary>
        [Column(TypeName = "decimal(10,2)")]
        public decimal Prepayment { get; set; }

        /// <summary>
        /// 患者的病情详细描述
        /// </summary>
        [Column(TypeName = "text")]
        public string ConditionDesc { get; set; } = string.Empty;

        /// <summary>
        /// 患者对某些药物的禁忌情况
        /// </summary>
        [Column(TypeName = "text")]
        public string DrugContraindications { get; set; } = string.Empty;

        /// <summary>
        /// 患者入院时间
        /// </summary>
        public DateTime AdmissionTime { get; set; } = DateTime.Now;


        /// <summary>
        /// 交款金额(单位:元)
        /// </summary>
        public decimal Amount { get; set; }

        /// <summary>
        /// 剩余金额(单位:元)
        /// </summary>
        public decimal RemainingAmount { get; set; }

        /// <summary>
        /// 已用金额(单位:元)
        /// </summary>
        public decimal UsageAmount { get; set; }

    }



    /// <summary>
    /// 病人查找条件
    /// </summary>
    public class GetPatientAdmissionDto
    {
        /// <summary>
        /// 患者卡号，标识患者
        /// </summary>
        public string ?Patient { get; set; }


        /// <summary>
        /// 用户姓名 - 必填，最大长度50位
        /// </summary>
        public string ?Name { get; set; }


        /// <summary>
        /// 关联科室表的外键,标识患者所属科室
        /// </summary>
        public int ?DepartmentId { get; set; }


        /// <summary>
        /// 病房编号,如301、302(支持前缀+数字)
        /// </summary>
        public string ?RoomNumber { get; set; }


        /// <summary>
        /// 所在楼层,如3、4
        /// </summary>
        public int ?Floor { get; set; }

    }




    /// <summary>
    /// 查找出院结果信息
    /// </summary>
    public class SearchregistrationresultsDto
    {
        /// <summary>
        /// 住院登记唯一标识,主键,自增
        /// </summary>
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int AdmissionId { get; set; }

        /// <summary>
        /// 患者卡号，标识患者
        /// </summary>
        [Required]
        [StringLength(20)]
        public string Patient { get; set; } = string.Empty;


        /// <summary>
        /// 用户姓名 - 必填，最大长度50位
        /// </summary>
        [Required]
        [StringLength(50)]
        public string Name { get; set; } = string.Empty;

        /// <summary>
        /// 关联科室表的外键,标识患者所属科室
        /// </summary>
        public int DepartmentId { get; set; }


        /// <summary>
        /// 科室类型
        /// </summary>
        public string DepartmentName { get; set; }

        /// <summary>
        /// 关联病房表的外键,标识患者入住的病房
        /// </summary>
        public int RoomId { get; set; }

        /// <summary>
        /// 病房编号,如301、302(支持前缀+数字)
        /// </summary>
        [Required]
        [StringLength(20)]
        public string RoomNumber { get; set; } = string.Empty;

        /// <summary>
        /// 所在楼层,如3、4
        /// </summary>
        public int Floor { get; set; }

        /// <summary>
        /// 关联病床号表的外键,标识患者入住的具体病床
        /// </summary>
        public int HospitalId { get; set; }

        /// <summary>
        /// 病床编号
        /// </summary>
        [Required]
        [StringLength(20)]
        public string HospitalName { get; set; } = string.Empty;

        /// <summary>
        /// 患者预交的费用金额(单位:元)
        /// </summary>
        [Column(TypeName = "decimal(10,2)")]
        public decimal Prepayment { get; set; }

        /// <summary>
        /// 患者的病情详细描述
        /// </summary>
        [Column(TypeName = "text")]
        public string ConditionDesc { get; set; } = string.Empty;

        /// <summary>
        /// 患者对某些药物的禁忌情况
        /// </summary>
        [Column(TypeName = "text")]
        public string DrugContraindications { get; set; } = string.Empty;

        /// <summary>
        /// 患者入院时间
        /// </summary>
        public DateTime AdmissionTime { get; set; } = DateTime.Now;


        /// <summary>
        /// 交款金额(单位:元)
        /// </summary>
        public decimal Amount { get; set; }

        /// <summary>
        /// 剩余金额(单位:元)
        /// </summary>
        public decimal RemainingAmount { get; set; }

        /// <summary>
        /// 已用金额(单位:元)
        /// </summary>
        public decimal UsageAmount { get; set; }

        /// <summary>
        /// 药品名称
        /// </summary>
        [Required]
        [StringLength(50)]
        public string MedicineName { get; set; }

        /// <summary>
        /// 药品类型(如:西药、中药等)
        /// </summary>
        [StringLength(50)]
        public string DrugType { get; set; }

        /// <summary>
        /// 药品费用名称(如:西药费、中药费等)
        /// </summary>
        [StringLength(50)]
        public string FeeName { get; set; }

        /// <summary>
        /// 剂型(如:片剂、颗粒等)
        /// </summary>
        [StringLength(50)]
        public string DosageForm { get; set; }

        /// <summary>
        /// 规格
        /// </summary>
        [StringLength(50)]
        public string Specification { get; set; }

        /// <summary>
        /// 进价(单位:元)
        /// </summary>
        [Column(TypeName = "decimal(10,2)")]
        public decimal? PurchasePrice { get; set; }

        /// <summary>
        /// 售价(单位:元)
        /// </summary>
        [Column(TypeName = "decimal(10,2)")]
        public decimal SellingPrice { get; set; }

        /// <summary>
        /// 库存数量
        /// </summary>
        public int StockQuantity { get; set; }



        /// <summary>
        /// 生产日期
        /// </summary>
        public DateTime ProductionDate { get; set; }

        /// <summary>
        /// 有效日期
        /// </summary>
        public DateTime ExpirationDate { get; set; }

        /// <summary>
        /// 病功效
        /// </summary>
        [Column(TypeName = "text")]
        public string Efficacy { get; set; }

    }


    public class GetPatientAdmissiondischargeDto
    {
        /// <summary>
        /// 患者卡号，标识患者
        /// </summary>
        public string? Patient { get; set; }


        /// <summary>
        /// 用户姓名 - 必填，最大长度50位
        /// </summary>
        public string? Name { get; set; }

    }
}
